<include file="public@header"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>
<script type="text/html" id="files-item-tpl">
    <li id="saved-file{id}">
        <input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
        <input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
               style="width: 200px;" title="文件名称">
        <a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
        <a href="javascript:uploadOne('文件上传','#file-{id}','file');">替换</a>
        <a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
    </li>
</script>
</head>
<body>
<div class="wrap">
    <form method="post" class="form-horizontal js-ajax-form-new margin-top-20" action="{:url('pay/resource/editPostActive')}">
        <div class="form-group">
            <div class="form-group">
                <label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>活动标题</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" id="input-user_login" name="title" placeholder="活动标题"
                           required value="{$info.title}">
                </div>
            </div>
            <label for="input-site-name" class="col-sm-2 control-label"><span
                    class="form-required">*</span>缩略图</label>
            <div class="col-md-6 col-sm-10">
                <div>
                    <input type="hidden" name="image" id="thumbnail"
                           value="{$info.image|default=''}" required>
                    <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                        <if condition="empty($info.image)">
                            <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                 id="thumbnail-preview"
                                 width="135" style="cursor: pointer"/>
                            <else/>
                            <img src="{$info.image}"
                                 id="thumbnail-preview"
                                 width="135" style="cursor: pointer"/>
                        </if>
                    </a>
                    <span style="color: red">(限制:jpg/png,小于500k)</span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_login" class="col-sm-2 control-label">活动详情</label>
            <div class="col-md-6 col-sm-10">
                <script type="text/plain" id="content" name="content">{:html_entity_decode($info['content'])}</script>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <input type="hidden" name="id" value="{$info['id']}">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });
</script>
</body>
</html>